﻿using System;
using System.Data;
using System.Collections;
using CE.Database;

/// <summary>
/// Summary description for HsbcProposalDB
/// </summary>
/// 
namespace CE.PersonalAccident
{
    public class HsbcProposalDB
    {
        public HsbcProposalDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(HsbcProposal hsbcproposal)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocPAProposalInsertUpdateSingleItemHsbc";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@PAProposalId", hsbcproposal.PAProposalId);
            _sPara.Add("@PAId", hsbcproposal.PAId);
            _sPara.Add("@PACompanyId", hsbcproposal.PACompanyId);
            _sPara.Add("@PAInsId", hsbcproposal.PAInsId);
            _sPara.Add("@Salutation", hsbcproposal.Salutation);
            _sPara.Add("@Name", hsbcproposal.Name);
            _sPara.Add("@PostalCode", hsbcproposal.PostalCode);
            _sPara.Add("@UnitNo", hsbcproposal.UnitNo);
            _sPara.Add("@HomeNo", hsbcproposal.HomeNo);
            _sPara.Add("@Address", hsbcproposal.Address);
            _sPara.Add("@Gender", hsbcproposal.Gender);
            _sPara.Add("@MaritalStatus", hsbcproposal.MaritalStatus);
            _sPara.Add("@NRICNo", hsbcproposal.NRICNo);
            _sPara.Add("@Nationality", hsbcproposal.Nationality);
            _sPara.Add("@MobileNo", hsbcproposal.MobileNo);
            _sPara.Add("@HomePhoneNo", hsbcproposal.HomePhoneNo);
            _sPara.Add("@OfficePhoneNo", hsbcproposal.OfficePhoneNo);
            _sPara.Add("@Email", hsbcproposal.Email);
            _sPara.Add("@SpouseName", hsbcproposal.SpouseName);
            _sPara.Add("@SpouseNRICNo", hsbcproposal.SpouseNRICNo);
            _sPara.Add("@SpouseNationality", hsbcproposal.SpouseNationality);
            _sPara.Add("@SPRPRStatus", hsbcproposal.SPRPRStatus);
            _sPara.Add("@ElgibleAge", hsbcproposal.ElgibleAge);
            _sPara.Add("@EngagedOccupation", hsbcproposal.EngagedOccupation);
            _sPara.Add("@PamentType", hsbcproposal.PamentType);           
            _sPara.Add("@RefCEUserId", hsbcproposal.RefCEUserId);
            _sPara.Add("@ViewedDetailId", hsbcproposal.ViewedDetailId);
            _sPara.Add("@Status", hsbcproposal.Status);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        //Not Using
        public Int64 InsertNew(HsbcProposal hsbcproposal)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocPAProposalInsertUpdateSingleItemHsbc_New";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@PAProposalId", hsbcproposal.PAProposalId);
            _sPara.Add("@PAId", hsbcproposal.PAId);
            _sPara.Add("@PACompanyId", hsbcproposal.PACompanyId);
            _sPara.Add("@PAInsId", hsbcproposal.PAInsId);
            _sPara.Add("@Salutation", hsbcproposal.Salutation);
            _sPara.Add("@Name", hsbcproposal.Name);
            _sPara.Add("@PostalCode", hsbcproposal.PostalCode);
            _sPara.Add("@UnitNo", hsbcproposal.UnitNo);
            _sPara.Add("@HomeNo", hsbcproposal.HomeNo);
            _sPara.Add("@Address", hsbcproposal.Address);
            _sPara.Add("@Gender", hsbcproposal.Gender);
            _sPara.Add("@MaritalStatus", hsbcproposal.MaritalStatus);
            _sPara.Add("@NRICNo", hsbcproposal.NRICNo);
            _sPara.Add("@Nationality", hsbcproposal.Nationality);
            _sPara.Add("@MobileNo", hsbcproposal.MobileNo);
            _sPara.Add("@HomePhoneNo", hsbcproposal.HomePhoneNo);
            _sPara.Add("@OfficePhoneNo", hsbcproposal.OfficePhoneNo);
            _sPara.Add("@Email", hsbcproposal.Email);
            _sPara.Add("@SpouseName", hsbcproposal.SpouseName);
            _sPara.Add("@SpouseNRICNo", hsbcproposal.SpouseNRICNo);
            _sPara.Add("@SpouseNationality", hsbcproposal.SpouseNationality);
            _sPara.Add("@SPRPRStatus", hsbcproposal.SPRPRStatus);
            _sPara.Add("@ElgibleAge", hsbcproposal.ElgibleAge);
            _sPara.Add("@EngagedOccupation", hsbcproposal.EngagedOccupation);
            _sPara.Add("@PamentType", hsbcproposal.PamentType);
            _sPara.Add("@RefCEUserId", hsbcproposal.RefCEUserId);
            _sPara.Add("@ViewedDetailId", hsbcproposal.ViewedDetailId);
            _sPara.Add("@Status", hsbcproposal.Status);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

    }
}